package com.fsc.mapper;

import com.fsc.entity.domain.ChildSituation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
* @author 86183
* @description 针对表【child_situation(子女监控情况表)】的数据库操作Mapper
* @createDate 2024-06-02 13:15:22
* @Entity com.fsc.domain.ChildSituation
*/
public interface ChildSituationMapper extends BaseMapper<ChildSituation> {

    @Select("SELECT * FROM child_situation WHERE class_id = #{classId}")
    List<ChildSituation> getVideosByClassId(@Param("classId") int classId);

    @Insert("INSERT INTO child_situation (class_id, video_url, time) VALUES (#{classId}, #{videoUrl}, #{time})")
    void insert(@Param("classId") int classId, @Param("videoUrl") String videoUrl, @Param("time") String time);

    @Delete("DELETE FROM child_situation WHERE id = #{id}")
    void deleteById(@Param("id") int id);

    @Update("UPDATE child_situation SET class_id = #{classId}, video_url = #{videoUrl}, time = #{time} WHERE id = #{id}")
    void update(@Param("id") int id, @Param("classId") int classId, @Param("videoUrl") String videoUrl, @Param("time") String time);
}





